<?php

namespace app\wempapi\model;

use think\Model;

/**
 * ServService
 */
class ServService extends Model
{
    // 表名
    protected $name = 'serv_service';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;


    public function getImageAttr($value): string
    {
        if ($value === '' || $value === null) return '';
        return full_url().$value;
    }

    public function getImagesAttr($value): array
    {
        if ($value === '' || $value === null) return [];
        if (!is_array($value)) {
            return explode(',', $value);
        }
        foreach ($value as $key => $val) {
            $value[$key] = full_url().$val;
        }
        return $value;
    }
}